from django.contrib.auth.models import User
from django.db import models
from datetime import datetime
# Create your models here.

Bug_types = [
    (0, "客户问题"),
    (1, "测试问题"),
    (3, "定制问题"),
]

Bug_probabilitys = [
    (0, "出现一次"),
    (1, "偶尔"),
    (2, "经常"),
    (3, "必现")
]


class Bug(models.Model):
    id = models.AutoField(primary_key=True, verbose_name="BugID")
    bug_type = models.SmallIntegerField(blank=False, choices=Bug_types, verbose_name="Bug类型")
    bug_probability = models.SmallIntegerField(choices=Bug_probabilitys, verbose_name="出现几率")
    bug_desc = models.TextField(max_length=1024, blank=False, verbose_name="问题描述")
    bug_recurrent = models.TextField(max_length=1024, blank=False, verbose_name="复现步骤")
    bug_owner = models.ForeignKey(User, null=True, verbose_name="当前处理人", on_delete=models.SET_NULL)
    created_date = models.DateTimeField(verbose_name="创建日期", default=datetime.now)
    modified_date = models.DateTimeField(verbose_name="修改时间", default=datetime.now)

